﻿using System.Collections.Generic;

namespace CSW.Framework.Common.Utils.ExcelUtils
{
    /// <summary>
    /// Excel Formula.
    /// </summary>
    public class Formula
    {
        private readonly object m_Result;
        private readonly List<RPNToken> m_RPNTokenArray;

        /// <summary>
        /// Initializes a new instance of the <see cref="Formula"/> class.
        /// </summary>
        /// <param name="result">The result of the formula.</param>
        /// <param name="rpnTokenArray">The RPN token array.</param>
        public Formula(object result, List<RPNToken> rpnTokenArray)
        {
            m_Result = result;
            m_RPNTokenArray = rpnTokenArray;
        }

        /// <summary>
        /// Gets the result of the formula.
        /// </summary>
        /// <value>The result of the formula.</value>
        public object Result
        {
            get { return m_Result; }
        }

        /// <summary>
        /// Gets the RPN token array.
        /// </summary>
        /// <value>The RPN token array.</value>
        public List<RPNToken> RPNTokenArray
        {
            get { return m_RPNTokenArray; }
        }

        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the <see cref="Result"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the <see cref="Result"/>.
        /// </returns>
        public override string ToString()
        {
            return string.Format("{0}", m_Result);
        }
    }
}
